{% extends "layout.html" %}

{% block header -%}
{{ super() }}
<hr/>
<script>
  function autoLink(className) {
    var comments = document.querySelectorAll(className);
    for(var i = 0; i < comments.length; i++) {
      comments[i].innerHTML = comments[i].innerHTML.replace(/https?:\/\/[^ \t\n<]*/g, '<a href="$&">$&</a>');
    }
  }

  window.addEventListener("load", function() {
    autoLink('.DevComment');
  }, false);
</script>

<div class="Announcement">

<iframe id="tree_status" width="100%" height="44" frameborder="0" scrolling="no" src="https://nativeclient-status.appspot.com/current"></iframe>

<center style="padding: 0 7px">
  <table width="100%" valign="top" bgcolor="#efefef" style="-webkit-border-bottom-left-radius: 24px; -webkit-border-bottom-right-radius: 24px; -moz-border-bottom-right-radius: 24px; -moz-border-bottom-right-radius: 24px;   box-shadow: 2px 2px 6px rgba(0,0,0,0.6); -moz-box-shadow: 2px 2px 6px rgba(0,0,0,0.6); -webkit-box-shadow: 2px 2px 6px rgba(0,0,0,0.6);">
    <tr>
      <td width="23%">
        <table valign="top" width="100%">
          <tr><td><h3 id="project_title">NativeClient</h3></td></tr>
          <tr>
            <td style="text-align: right;">
              <b>Controls:</b>
            </td>
            <td>
              <a id="tree_status_link"
                 href="https://nativeclient-status.appspot.com">tree status</a> |
            </td>
          </tr>
          <tr>
            <td style="text-align: right;">
              <b>Dashboards:</b>
            </td>
            <td>
              <a href="./stats">
                stats</a> |
              <a id="status_viewer"
                 href="https://nativeclient-status.appspot.com/status_viewer">
                tree status history</a> |
              <a href="https://chromeperf.appspot.com/report?masters=NativeClient">
                perf (runtime)</a> |
              <a href="https://chromeperf.appspot.com/report?masters=NativeClientToolchain">
                perf (toolchain)</a>
            </td>
          </tr>
          <tr>
            <td style="text-align: right;">
              <b>Development:</b>
            </td>
            <td>
              <a id="source_link"
                 href="https://src.chromium.org/viewvc/native_client/trunk/">
                source</a> |
              <a href="https://codereview.chromium.org/">reviews</a> |
              <a href="https://code.google.com/p/nativeclient/issues/list">
                bugs</a> |
              <a id="www_link"
                 href="https://code.google.com/p/nativeclient">www</a>
            </td>
          </tr>
          <tr>
            <td style="text-align: right;">
              <b>LKGR:</b>
            </td>
            <td>
              <iframe width="100%" height="30" frameborder="0" scrolling="no"
                src="https://nativeclient-status.appspot.com/lkgr"></iframe>
            </td>
          </tr>
          <tr>
            <td style="text-align: right;">
               <b>Sheriffs:</b>
            </td>
            <td>
              <script src='./nacl_sheriff.js'></script>
            </td>
          </tr>
          <tr>
            <td style="text-align: right;">
               <b>Buildbot:</b>
            </td>
            <td colspan="2">
              <a href="http://dev.chromium.org/developers/testing/chromium-build-infrastructure/tour-of-the-chromium-buildbot">about</a> |
              <a href="./waterfall/help">customize</a> |
              <a href="./waterfall">waterfall</a> |
              <a href="./waterfall?show_events=true&failures_only=true">failures</a> |
              <a href="./console">console</a>
            </td>
          </tr>
          <tr>
            <td style="text-align: right;">
               <b>Waterfalls:</b>
            </td>
            <td colspan="2">
              <a name="menu1" id="NativeClient"
                 href="../client.nacl/">NativeClient</a> |
              <a name="menu1" id="NativeClientToolchain"
                 href="../client.nacl.toolchain/">Toolchain</a> |
              <a name="menu1" id="NativeClientPorts"
                 href="../client.nacl.ports/">NaCl&nbsp;Ports</a> |
              <a name="menu1" id="NativeClientSDK"
                 href="../client.nacl.sdk/">SDK</a> |
              <a name="menu1" id="NativeClientSDKAddin"
                 href="../client.nacl.sdk.addin/">SDK Addin</a> |
              <a name="menu1" id="NativeClientTryServer"
                 href="../tryserver.nacl/waterfall">Trybots</a>
            </td>
          </tr>
        </table>
      </td>
      <td width="2" bgcolor="#CCCCCC">
      </td>
      <td>
      </td>
      <td width="72%">
        <table width="100%" id ="dashboard">
          <script language="javascript">
            var request = new XMLHttpRequest();
            request.onreadystatechange = function() {
              if (request.readyState != 4) return;
              if (request.status !=200) return;
              var data = eval('(' + request.responseText + ')');

              // Setup waterfall name.
              document.getElementById(
                  'project_title').innerHTML = data.project.title;

              // Disable waterfall links to this page.
              var waterfall_links = document.getElementsByName('menu1');
              for (var i = 0; i < waterfall_links.length; i++) {
                if (waterfall_links[i].id == data.project.title) {
                  waterfall_links[i].href = null;
                  waterfall_links[i].style.color = 'gray';
                }
              }

              // Switch tree status to the relevant instance.
              var tree_status_link = document.getElementById('tree_status_link');
              var source_link = document.getElementById('source_link');
              var www_link = document.getElementById('www_link');
              if (data.project.title == 'NativeClientPorts') {
                tree_status_link.href = 'https://naclports-status.appspot.com/';
                source_link.href = 'https://code.google.com/p/naclports/source/browse/#svn/trunk';
                www_link.href = 'https://code.google.com/p/naclports';
              } else if (data.project.title == 'NativeClientSDK') {
                tree_status_link.href = 'https://chromium-status.appspot.com/';
                source_link.href = 'https://src.chromium.org/viewvc/chrome/trunk/src/native_client_sdk/';
                www_link.href = 'https://src.chromium.org';
              } else if (data.project.title == 'NativeClientRagel') {
                tree_status_link.href = 'https://chromium-status.appspot.com/';
                source_link.href = 'https://src.chromium.org/viewvc/chrome/trunk/src/';
                www_link.href = 'https://code.google.com/p/chromium';
              } else {
                tree_status_link.href = 'https://nativeclient-status.appspot.com/';
                source_link.href = 'https://src.chromium.org/viewvc/native_client/trunk/';
                www_link.href = 'https://code.google.com/p/nativeclient';
              }
              document.getElementById(
                  'tree_status').src = tree_status_link.href + 'current';
              document.getElementById(
                  'status_viewer').href = tree_status_link.href + 'status_viewer';

              // Add dashboard.
              var flavors = {};
              for (var i in data.builders) {
                var category = data.builders[i].category.split('|')[0];
                if (!(category in flavors)) flavors[category] = [];
                flavors[category].push('builder=' + i);
              }
              for (var category in flavors) {
                flavors[category].push('titles=on');
              }
              var bar = "./horizontal_one_box_per_builder"
              var waterfall = "./waterfall"
              function GetUrl(type, content) {
                return type + "?" + content + "&reload=30";
              }
              function DisplayBar(content, name) {
                var dash = document.getElementById('dashboard');
                dash.innerHTML += ("<tr><td><a href='" + GetUrl(waterfall, content) + "'>" + name + "</a></td><td width='99%'><iframe width='100%' height='20' frameborder='0' scrolling='no' src='" + GetUrl(bar, content) + "'></iframe></td></tr>\n");
              }
              var order = [];
              for (var i in flavors) {
                order.push(i);
              }
              order.sort();
              for (var i = 0; i < order.length; i++) {
                DisplayBar(flavors[order[i]].join('&'),
                           order[i].replace(/^[0-9]+/, ''));
              }
            };
            request.open('GET', './json', true);
            request.send(null);
          </script>
        </table>
        </td></tr></table>
      </td>
      <td width="3%">
      </td>
    </tr>
  </table>
</center>

</div>
{% endblock header %}

{% block footer %}

{{ super() }}
{# <p>Debug info: {{ debuginfo }}</p> #}
{% endblock %}
